# -*- coding: utf-8 -*-
# @description: 
# @File  : sqlitedb.py
# @Time  :2022-09-19 14:35:24
# @Author:selfeasy
# @Email :selfeasy@qq.com
import sqlite3,time
coon = sqlite3.connect('./tokens')
c = coon.cursor()
c.execute('''
    create table if not exists tokeniddb (
        id VARCHAR(255) not null,
        timestamp VARCHAR(255) not null,
        status TINYINT(2) not null default '-1',
        unique(timestamp, id)
    );''')

sql = '''insert into tokeniddb(id, timestamp) values(?,?)'''
a=str(int(time.time()))
c.execute(sql, ('111111',a))
datas=c.execute('''select * from tokeniddb where id="111111" and timestamp=?''',(a,))
print(list(datas))

c.execute('delete from tokeniddb where id = ?',('111111',))
datas=c.execute('''select * from tokeniddb where id="111111" and timestamp=?''',(a,))
print('after',list(datas))